package com.marketsim.analysis;

import com.marketsim.common.bean.BigDecimalElement;
import com.marketsim.common.bean.HistoryPriceBean;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by Alex on 30.03.2014.
 */
public class PortfolioAnalysis {

    public void analyze(List<? extends BigDecimalElement> data) {
        StatisticCalculator calculator = new StatisticCalculator();
        System.out.println("Standard deviation = " + calculator.getStdDev(data));
    }

    public void analyzeHistoryPriceBean(List<HistoryPriceBean> data) {
        BigDecimalConverter<HistoryPriceBean> converter = (from) -> from.getClose();
        System.out.println("Standard deviation Lamda= " + StatisticCalculatorJ8.getStdDev(data, converter));
        System.out.println("Sharp ratio Lamda= " + StatisticCalculatorJ8.getSharpRatio(data, converter));
        System.out.println("Median Lamda= " + StatisticCalculatorJ8.getMedian(data, converter));
    }

    public void analyzeHistoryPriceBeanFromBigDecimal(List<BigDecimal> data) {
        System.out.println("Standard deviation Lamda= " + StatisticCalculatorJ8.getStdDev(data));
        System.out.println("Sharp ratio Lamda= " + StatisticCalculatorJ8.getSharpRatio(data));
        System.out.println("Median Lamda= " + StatisticCalculatorJ8.getMedian(data));
    }
}
